package ua.org.nuos.sdms.clientgui.client.view;

import com.vaadin.ui.ComponentContainer;
import ua.org.nuos.sdms.clientgui.client.components.tabs.ICustomTab;
import ua.org.nuos.sdms.clientgui.client.components.window.AbstractWindow;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: dio
 * Date: 08.03.12
 * Time: 16:51
 * To change this template use File | Settings | File Templates.
 */
public class ComponentLocator {

    private Map<String, AbstractWindow> windows;
    private Map<String, ComponentContainer> containers;
    private Map<String, ICustomTab> tabs;

    public ComponentLocator() {
        windows = new HashMap<String, AbstractWindow>();
        containers = new HashMap<String, ComponentContainer>();
        tabs = new HashMap<String, ICustomTab>();
    }

    public Map<String, AbstractWindow> getWindows() {
        return windows;
    }

    public Map<String, ComponentContainer> getContainers() {
        return containers;
    }

    public Map<String, ICustomTab> getTabs() {
        return tabs;
    }

    public AbstractWindow getWindow(String key) {
        return windows.get(key);
    }

    public void addWindow(String key, AbstractWindow window) {
        windows.put(key, window);
    }

    public ComponentContainer getContainer(String key) {
        return containers.get(key);
    }

    public void addContainer(String key, ComponentContainer container) {
        containers.put(key, container);
    }

    public ICustomTab getTab(String key) {
        return tabs.get(key);
    }

    public void addTab(String key, ICustomTab container) {
        tabs.put(key, container);
    }

    public void resetData() {
        windows.clear();
        containers.clear();
        tabs.clear();
    }
}
